<?php
class Admin_Model_Mail extends Zend_Db_Table_Abstract
{
    protected $_name = 'mailing';
	protected $_primary  = 'p_mailing';
    
	public function getListMail() 
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->order('dtcreat desc', 'hrcreat desc');
		
		return $this->getAdapter()->fetchAll($sql);
	}
	
	public function getMail($id)
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->where('p_mailing = ?', $id);
		
		return $this->getAdapter()->fetchRow($sql);
	}
	
	public function removeMail($id)
	{
		$this->getAdapter()->delete($this->_name, "p_mailing =" . $id);
		return true;
	}
}